package com.cg.servlet;


import com.cg.service.StudentService;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet("/student/remove")
public class RemoveStuServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取学生编号参数
        String stuNo = req.getParameter("stuNo");
        StudentService service=new StudentService();
        boolean result = service.remove(stuNo);
        if (result){
            resp.sendRedirect(req.getContextPath()+"/student/list");
        }
    }
}
